From 88e408ccda43d69257db409e71d09100cd9437f1 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Sat, 28 Oct 2006 11:54:05 +0100 Subject: [PATCH] Fix freeing of records, when the given pointer is NULL. Signed-off-by: Ewan Mellor --- tools/libxen/src/xen_host.c | 4 ++++ tools/libxen/src/xen_host_cpu.c | 4 ++++ tools/libxen/src/xen_network.c | 4 ++++ tools/libxen/src/xen_pif.c | 4 ++++ tools/libxen/src/xen_sr.c | 4 ++++ tools/libxen/src/xen_user.c | 4 ++++ tools/libxen/src/xen_vbd.c | 4 ++++ tools/libxen/src/xen_vdi.c | 4 ++++ tools/libxen/src/xen_vif.c | 4 ++++ tools/libxen/src/xen_vm.c | 4 ++++ tools/libxen/src/xen_vtpm.c | 4 ++++ 11 files changed, 44 insertions(+) diff --git a/tools/libxen/src/xen_host.c b/tools/libxen/src/xen_host.c index 455f57d04c..849ed12238 100644 --- a/tools/libxen/src/xen_host.c +++ b/tools/libxen/src/xen_host.c @@ -76,6 +76,10 @@ const abstract_type xen_host_record_abstract_type_ = void xen_host_record_free(xen_host_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name_label); diff --git a/tools/libxen/src/xen_host_cpu.c b/tools/libxen/src/xen_host_cpu.c index a18ded8150..f2b8927345 100644 --- a/tools/libxen/src/xen_host_cpu.c +++ b/tools/libxen/src/xen_host_cpu.c @@ -78,6 +78,10 @@ const abstract_type xen_host_cpu_record_abstract_type_ = void xen_host_cpu_record_free(xen_host_cpu_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); xen_host_record_opt_free(record->host); diff --git a/tools/libxen/src/xen_network.c b/tools/libxen/src/xen_network.c index 18d650ccbc..c774fe72df 100644 --- a/tools/libxen/src/xen_network.c +++ b/tools/libxen/src/xen_network.c @@ -74,6 +74,10 @@ const abstract_type xen_network_record_abstract_type_ = void xen_network_record_free(xen_network_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name_label); diff --git a/tools/libxen/src/xen_pif.c b/tools/libxen/src/xen_pif.c index 92ca6508d1..6210f32d65 100644 --- a/tools/libxen/src/xen_pif.c +++ b/tools/libxen/src/xen_pif.c @@ -80,6 +80,10 @@ const abstract_type xen_pif_record_abstract_type_ = void xen_pif_record_free(xen_pif_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name); diff --git a/tools/libxen/src/xen_sr.c b/tools/libxen/src/xen_sr.c index d94e1238dd..183ad77843 100644 --- a/tools/libxen/src/xen_sr.c +++ b/tools/libxen/src/xen_sr.c @@ -79,6 +79,10 @@ const abstract_type xen_sr_record_abstract_type_ = void xen_sr_record_free(xen_sr_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name_label); diff --git a/tools/libxen/src/xen_user.c b/tools/libxen/src/xen_user.c index 39a04b33f3..e98f0a0f86 100644 --- a/tools/libxen/src/xen_user.c +++ b/tools/libxen/src/xen_user.c @@ -60,6 +60,10 @@ const abstract_type xen_user_record_abstract_type_ = void xen_user_record_free(xen_user_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->short_name); diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c index 228b60943d..eac4e3f26b 100644 --- a/tools/libxen/src/xen_vbd.c +++ b/tools/libxen/src/xen_vbd.c @@ -79,6 +79,10 @@ const abstract_type xen_vbd_record_abstract_type_ = void xen_vbd_record_free(xen_vbd_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); xen_vm_record_opt_free(record->vm); diff --git a/tools/libxen/src/xen_vdi.c b/tools/libxen/src/xen_vdi.c index 11aaa48085..9246077ec4 100644 --- a/tools/libxen/src/xen_vdi.c +++ b/tools/libxen/src/xen_vdi.c @@ -93,6 +93,10 @@ const abstract_type xen_vdi_record_abstract_type_ = void xen_vdi_record_free(xen_vdi_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name_label); diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c index ac096a3cfd..d4723d80eb 100644 --- a/tools/libxen/src/xen_vif.c +++ b/tools/libxen/src/xen_vif.c @@ -84,6 +84,10 @@ const abstract_type xen_vif_record_abstract_type_ = void xen_vif_record_free(xen_vif_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name); diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index 73ccfb0454..c2f2ff7558 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -189,6 +189,10 @@ const abstract_type xen_vm_record_abstract_type_ = void xen_vm_record_free(xen_vm_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); free(record->name_label); diff --git a/tools/libxen/src/xen_vtpm.c b/tools/libxen/src/xen_vtpm.c index 75e90026f3..b3baabacd5 100644 --- a/tools/libxen/src/xen_vtpm.c +++ b/tools/libxen/src/xen_vtpm.c @@ -69,6 +69,10 @@ const abstract_type xen_vtpm_record_abstract_type_ = void xen_vtpm_record_free(xen_vtpm_record *record) { + if (record == NULL) + { + return; + } free(record->handle); free(record->uuid); xen_vm_record_opt_free(record->vm); -- 2.30.2